import {request} from '@umijs/max';
import type {CardListItemDataType} from './data.d';

export async function queryListForm(params: {
  page: number;
  size: number;
  keyWords?: string;
}): Promise<{
  data: {
    current_data: CardListItemDataType[];
    total_page: number;
    total_records: number;
  }
}> {
  return request('/product-server/api/v1/form_properties/page', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: params,
  });
}

export async function delForm(
  data: {
    id?: any;
  },
  options?: { [key: string]: any },
) {
  return request<{
    code:number;
    data: Record<string, any>;
    msg?: string;
  }>('/product-server/api/v1/form_properties/del', {
    method: 'DELETE',
    data,
    ...(options || {}),
  });
}
